//判断本地存储中是否有userInfo这个字段，如果有就return true 没有就false
import { useState } from "react";

export default function(initialState:object){
    let [userInfo,setUserInfo]=useState(initialState)
    let isLogin=JSON.parse(localStorage.getItem('userInfo') || '{}')
    function setInfo(newState:object){
        setUserInfo(newState)
    }

    return [isLogin,setInfo]

}